﻿using System;
using SteeringBehaviors;
using UnityEngine;

// Token: 0x020001DF RID: 479
public class FleeAction : AgentAction
{
	// Token: 0x06000A3C RID: 2620 RVA: 0x0005A444 File Offset: 0x00058644
	public FleeAction(IKinematic target, float time = 0f)
	{
		this.name = "Flee";
		this.target = target;
		if (time > 0f)
		{
			this.endTime = Time.time + time;
		}
	}

	// Token: 0x06000A3D RID: 2621 RVA: 0x0005A476 File Offset: 0x00058676
	public override void StartAction()
	{
		this.agent.movement.StartFlee(this.target);
	}

	// Token: 0x06000A3E RID: 2622 RVA: 0x0005A490 File Offset: 0x00058690
	public override bool IsCompleted()
	{
		if (this.endTime > 0f && Time.time > this.endTime)
		{
			this.Interrupt();
			return this.hasStarted;
		}
		return this.hasStarted && !this.agent.movement.move;
	}

	// Token: 0x06000A3F RID: 2623 RVA: 0x00059F3D File Offset: 0x0005813D
	public override void Interrupt()
	{
		this.agent.movement.Stop();
	}

	// Token: 0x04000F99 RID: 3993
	private float endTime;

	// Token: 0x04000F9A RID: 3994
	private IKinematic target;
}
